package android.tusnotas.changes;

import android.content.Context;
import android.content.res.Resources;
import android.tusnotas.activities.R;
import android.tusnotas.beans.Course;
import android.tusnotas.beans.News;

public class NewsChange implements Change{
	
	private Resources res;
	private News after;
	private Course course;
	
	public NewsChange() {
		super();
	}
	
	public NewsChange(Context context, News after, Course course) {
		super();
		this.res = context.getResources();
		this.after = after;
		this.course = course;
	}
	
	public String getBarTitle(){
		return res.getString(R.string.notification_new_news_title);
	}
	
	public String getTitle(){
		return res.getString(R.string.notification_new_news);
	}
	
	public Integer getInstanceId(){
		return course.getInstanceId();
	} 
	
	public Integer getCourseId(){
		return course.getId();
	}
	
	public String getContent(){
		if(res.getConfiguration().locale.getLanguage().equalsIgnoreCase("en")){
			return getEnglishContent();
		}else{
			return getSpanishContent();
		}
	};

	private String getEnglishContent() {
		return "The course "+this.course.getName()+" has news: "+this.after.getContent();
	}

	private String getSpanishContent() {
		return "Las novedades para el curso "+this.course.getName()+" son: "+this.after.getContent();
	}

	public News getAfter() {
		return after;
	}
	
	public void setAfter(News after) {
		this.after = after;
	}

}
